package com.my.study.mapstruct.assembler;

import com.my.study.mapstruct.dto.OrderDTO;
import com.my.study.mapstruct.entity.Order;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * DTO <——> Entity
 *
 * @author: yidujun
 * @create: 2021/06/23 15:57
 */
@Mapper
public interface OrderAssembler {
    OrderAssembler INSTANCE = Mappers.getMapper(OrderAssembler.class);

    /**
     * Entity -> DTO
     *
     * @param order 订单
     * @return
     */
    OrderDTO toDTO(Order order);

    /**
     * DTO -> Entity
     *
     * @param orderDTO
     * @return
     */
    Order toEntity(OrderDTO orderDTO);
}
